Skip to content

fix(node): take back this host's slot when it goes stale between scans - #21

Merged
mattmattox merged 1 commit into
mainfrom
claude/fix-register-stale-race
Oct 24, 2026
Merged

mattmattox merged 1 commit into
mainfrom
claude/fix-register-stale-race

Conversation

@mattmattox

Copy link
Copy Markdown
Contributor

TestRegisterTakesOtherPIDNamespaceSlotOnceStale failed in #13's CI (Register took slot 0, want slot 2, after 122 ms). This was a real race in Register, added in #15.

Register checks this host's failed slots, then waits on live-looking slots from other PID namespaces, then takes the first empty or failed slot. A slot that crossed the 10 s staleness threshold between the first scan and the wait was neither claimed nor watched. Register then took an empty slot and left the old journal to failure detection about 20 s later. A restarted container whose old heartbeat expires in that window would hit it. Register now rechecks every slot for this host's failed ones after the wait.

Tests on .66, all with -race:

  • New TestRegisterTakesOwnSlotThatGoesStaleWhileWaiting: fails 3/3 without the fix and passes 20/20 with it.
  • TestRegisterTakesOtherPIDNamespaceSlotOnceStale: passes 200/200.
  • Unit suite: passes.

🤖 Generated with Claude Code

Register checks this host's failed slots, then waits on its live-looking
slots from other PID namespaces, then takes the first empty or failed
slot. A slot that crossed the staleness threshold between the first scan
and the wait was neither claimed nor watched, so Register took an empty
slot and left the old journal to failure detection 20s later.
TestRegisterTakesOtherPIDNamespaceSlotOnceStale hit this in CI. Register
now rechecks every slot for this host's failed ones after the wait.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmattox
mattmattox merged commit 526d631 into main Oct 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant